<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>随机头像</title>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js">
    </script>
</head>
<body>
    <div id="app">
        <img :src="tupian" alt="">
        <button @click="change">点击一下</button>
    </div>
    <script src="./vue.js"></script>
    <script>
        let app=new Vue({
            el:"#app",
            data:{
                tupian:""
            },
            mounted() {
                this.change()
            },
            methods: {
                change() {
                    $.ajax({
                        type: "GET",
                        url: "https://api.muxiaoguo.cn/api/sjtx",
                        data: {
                            api_key: "1e40f4fc82479f7f",
                            method:"pc"//输出壁纸端mobile(手机端) pc(电脑端)
                        },
                        dataType: "json"
                    }).then(res => {
                        console.log(res);
                        this.tupian=res.data.imgurl;
                    })
                }
            }
        })
    </script>
</body>
</html>